﻿#region Usings

using System.Data.Entity.ModelConfiguration;
using Rail.Net.Core.Model;

#endregion

namespace Rail.Net.Data.Configuration
{
    public class GlobalTrainLabelMap : EntityTypeConfiguration<GlobalTrainLabel>
    {
        public GlobalTrainLabelMap()
        {
            ToTable("GlobalTrainLabels");
            HasKey(globalTrainLabel => globalTrainLabel.Id);

            Property(globalTrainLabel => globalTrainLabel.TrainLabel).IsRequired().HasMaxLength(10);
            Property(globalTrainLabel => globalTrainLabel.Domestic).IsRequired();
            Property(globalTrainLabel => globalTrainLabel.International).IsRequired();
            Property(globalTrainLabel => globalTrainLabel.ValidFrom).IsOptional();
            Property(globalTrainLabel => globalTrainLabel.ValidTo).IsOptional();
        }
    }
}